<!--下拉单选-->
<template>
  <el-select
    v-model="value"
    v-bind="extend"
    :id="'c' + columnId"
    :name="'c' + columnId"
    :size="size"
    :clearable="clearable"
    :multiple="multiple"
  >
    <el-option
      v-for="item in optionList"
      :key="'select' + columnId + item.value"
      :label="item.label"
      :value="item.value"
      :disabled="item.disabled"
    >
    </el-option>
  </el-select>
</template>

<script>
import { defineComponent, computed } from 'vue'
  import { ElSelect, ElOption } from 'element-plus'
// 引入组件需要的属性 引入表单子控件的管理类
import { itemProps, itemController, loadController } from '../../map'

export default defineComponent({
  name: 'el-from-select',
  inheritAttrs: false,
  components: {
    ElSelect, ElOption
  },
  props: {
    ...itemProps, // 基础属性
    modelValue: [String, Number, Array]
  },
  emits: ['update:modelValue'],
  setup (props, context) {
    const multiple = computed (() => props.controlType === 161)

    // 从后端获取数据
    const { loadDict } = loadController(props)
    loadDict()
    
    return {
      multiple,
      ...itemController(props, context.emit)
    }
  }
})
</script>
